package com.example.demo18serviceprovider.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @author Created by yawn on 2017-11-17 19:15
 */
@RestController
public class TestController {

    @GetMapping("/test")
    public String test(Principal principal) {
        String name = principal == null ? "none" : principal.getName();
        return "test with name: " + name;
    }
}
